# Description: This file contains a function that generates a codon lattice from an amino acid sequence and a codon table.
# Author: Shibo Li, MiQroEra
# Date: 2023-07-15
# PS: If you want to calculate other specis' codon lattice, 
# you can download the codon table from https://www.kazusa.or.jp/codon/cgi-bin/showcodon.cgi?species=9606&aa=1&style=N

def generate_codon_lattice(codon_table, amino_acid_sequence):
    codon_lattice = []
    for amino_acid in amino_acid_sequence:
        codons = [codon['codons'] for codon in codon_table if codon['one_letter'] == amino_acid][0]
        codon_lattice.append(codons)
    return codon_lattice

